﻿@{
    Layout = null;
    Admin my = ViewBag.admin;
}
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment env
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台管理中心</title>
    <link href="~/lib/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/hplus/css/style.css" rel="stylesheet" />
    <link href="~/hplus/css/font-awesome.min.css" rel="stylesheet" />
    <link href="~/hplus/css/animate.min.css" rel="stylesheet" />
    <link href="~/hplus/css/login.css" rel="stylesheet" />
    <link href="~/js/treegrid/jquery.treegrid.css" rel="stylesheet" />
    <script src="~/js/jquery2.min.js"></script>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-3">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <span class="label label-success pull-right">@(DateTime.Now.ToString("yyyy年MM月dd日"))</span>
                        <h5>网站文章数量</h5>
                    </div>
                    <div class="ibox-content">
                        <h1 class="no-margins">@(Article.FindCount(null,null,null,0,0))</h1>
                        <div class="stat-percent font-bold text-success">
                            <span id="resultspan"></span> <i class="fa fa-bolt"></i>
                        </div>
                        <small>系统总的文章数量</small>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <span class="label label-info pull-right">全部</span>
                        <h5>总产品数量</h5>
                    </div>
                    <div class="ibox-content">
                        <h1 class="no-margins">@(Product.FindCount(null,null,null,0,0))</h1>
                        <small>系统总产品数量</small>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>总会员数量</h5>
                    </div>
                    <div class="ibox-content">
                        <h1 class="no-margins">@(Member.FindCount(null,null,null,0,0))</h1>
                        <div class="stat-percent font-bold text-danger">
                            <i class="fa fa-level-up"></i>
                        </div>
                        <small>系统总会员数量</small>
                    </div>
                </div>
            </div>
            <div class="col-sm-3">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>未读留言</h5>
                    </div>
                    <div class="ibox-content">
                        <h1 class="no-margins" id="smsCount">@(Guestbook.FindCount(Guestbook._.IsRead==0, null,null,0,0))</h1>
                        <small>未读留言数量</small>
                    </div>
                </div>
            </div>
        </div>

        @if(my.Roles.IsSuperAdmin == 1)
        {
    <div class="row">
        <div class="col-sm-4">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>服务器信息</h5>
                </div>
                <div class="ibox-content">

                    <div class="row">
                        <div class="col-sm-12">
                            <table class="table table-hover table-bordered">
                                <tbody>
                                    <tr>
                                        <td class="text-center small">服务器名称</td>
                                        <td>
                                            @Environment.MachineName
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="text-center small">操作系统</td>
                                        <td>
                                            @System.Runtime.InteropServices.RuntimeInformation.OSDescription
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="text-center small">系统架构</td>
                                        <td>
                                            @System.Runtime.InteropServices.RuntimeInformation.OSArchitecture
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="text-center small">核心数</td>
                                        <td>
                                            @Environment.ProcessorCount
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-4">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>应用程序信息</h5>
                </div>
                <div class="ibox-content">

                    <div class="row">
                        <div class="col-sm-12">
                            <table class="table table-hover table-bordered">
                                <tbody>
                                    <tr>
                                        <td class="text-center small">本程序绝对路径</td>
                                        <td>
                                            @ViewBag.contentPath
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="text-center small">站点物理路径</td>
                                        <td>
                                            @ViewBag.rootPath

                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="text-center small">服务器地址</td>
                                        <td>
                                            @Utils.GetServerUrl():@(ViewBag.port)
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="text-center small">服务器IP地址</td>
                                        <td>
                                            @Utils.GetIP()
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-4">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>.NET Core 信息</h5>
                </div>
                <div class="ibox-content">

                    <div class="row">
                        <div class="col-sm-12">
                            <table class="table table-hover table-bordered">
                                <tbody>
                                    <tr>
                                        <td class="text-center small">.NET Core版本</td>
                                        <td>
                                            @Html.Raw(System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription)
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="text-center small">环境变量</td>
                                        <td>
                                            @Html.Raw(env.EnvironmentName)
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="text-center small">内存占用</td>
                                        <td>
                                            @Html.Raw(((Double)System.Diagnostics.Process.GetCurrentProcess().WorkingSet64 / 1048576).ToString("N2") + " MB")
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="text-center small">启动时间</td>
                                        <td>
                                            @System.Diagnostics.Process.GetCurrentProcess().StartTime.ToString("yyyy-MM-dd HH:mm:ss")
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
        }
    </div>
    <script src="~/js/treegrid/jquery.treegrid.min.js"></script>
    <script src="~/js/treegrid/jquery.treegrid.bootstrap3.js"></script>
    <script src="~/hplus/js/common.js"></script>
</body>

</html>